<%@ Page Language="C#" MasterPageFile="~/Danser.Master" AutoEventWireup="true" CodeBehind="Authorizations.aspx.cs" Inherits="Danser_AJAXEnabledWebApplication.Authorizations" Title="Danser - Authorizations" %>

<%@ Register src="User Controls/MultiSelectList.ascx" tagname="multiselectlist" tagprefix="uc2" %>

<%@ Register src="User Controls/ExpressionBuilder.ascx" tagname="expressionbuilder" tagprefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager" runat="server">
    </asp:ScriptManager>
    <table style="width: 100%; height: 104px">
        <tr>
            <td style="height: 21px">
                <asp:Label ID="titleLabel" runat="server" CssClass="StandardLabel" Text="Define user permissions:"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="height: 21px" colspan="2">
                <asp:UpdatePanel ID="dataGridUpdatePanel" runat="server">
                    <ContentTemplate>

    <asp:Panel ID="MainPanel" runat="server" BackColor="Lavender"
    Width="100%" BorderColor="MidnightBlue">
    <br />
    <table width="100%">
        <tr>
            <td align="left" colspan="2" style="height: 34px" valign="middle">
                <asp:Panel ID="FilterPanel" runat="server" Width="100%">
                    <table style="width:100%;">
                        <tr>
                            <td valign="top" width="200px">
                                <asp:Label ID="selectLabel" runat="server" Font-Bold="True" 
                                    Font-Names="Arial" Font-Size="10pt" ForeColor="MidnightBlue" 
                                    Text="Select columns to display:"></asp:Label>
                            </td>
                            <td align="left" valign="top" width="80px">
                                <uc2:MultiSelectList ID="columnsMultiSelectList" runat="server" />
                            </td>
                            <td align="left" valign="top">
                                <asp:Button ID="filterButton" runat="server" BackColor="MidnightBlue" 
                                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                                    Font-Names="Arial" ForeColor="White" OnClick="filterButton_Click" 
                                    Text="Confirm" ToolTip="Display selected fields only" Width="70px" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="2" valign="middle">
                <asp:Button ID="filterUsersButton" runat="server" CssClass="StandardButton" 
                    Text="Search Users" Width="100px" onclick="filterUsersButton_Click" />
            </td>
        </tr>
        <tr>
            <td align="left" colspan="2" valign="middle">
                <asp:Panel ID="usersQueryPanel" runat="server" Visible="False" Width="100%">
                    <table style="width:100%;">
                        <tr>
                            <td>
                                <uc1:ExpressionBuilder ID="usersQueryExpressionBuilder" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Button ID="executeUsersQueryButton" runat="server" 
                                    CssClass="StandardButton" 
                                    Text="SELECT" onclick="executeUserQueryButton_Click" 
                                    ToolTip="Execute query" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
        <tr>
            <td align="left" colspan="1"><!-- colspan="2" rowspan=""-->
                &nbsp;</td>
        </tr>
        <tr>
            <td align="left" colspan="1">
                <!-- colspan="2" rowspan=""-->&nbsp;</td>
        </tr>
        <tr>
            <td align="left" colspan="1">
                <!-- colspan="2" rowspan=""-->
                <asp:Button ID="selectAllButton" runat="server" BackColor="MidnightBlue" 
                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                    ForeColor="White" OnClick="selectAllButton_Click" 
                    Text="All" ToolTip="Select all rows" Width="70px" 
                    CssClass="StandardButton" />
                &nbsp; &nbsp;
                <asp:Button ID="selectNoneButton" runat="server" BackColor="MidnightBlue" 
                    BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" 
                    OnClick="selectNoneButton_Click" Text="None" ToolTip="Deselect all rows" 
                    Width="70px" CssClass="StandardButton" />
                <asp:UpdateProgress ID="authorizationsUpdateProgress" runat="server" 
                    AssociatedUpdatePanelID="dataGridUpdatePanel" DisplayAfter="300">
                    <ProgressTemplate>
                        <table style="width:100%;">
                            <tr>
                                <td>
                                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Resourses/Images/info.bmp" />
                                </td>
                                <td colspan="1">
                                    <asp:Label ID="waitLabel" runat="server" Font-Bold="False" 
                                        Font-Names="Arial" Font-Size="10pt" ForeColor="Black" 
                                        Text="Please wait while executing..."></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </td>
        </tr>
        <tr>
            <td align="left" valign="top" width="800px">
                <asp:GridView ID="dataGridView" runat="server" AutoGenerateColumns="False" 
                    BackColor="LightGray" BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                    DataKeyNames="UserID" DataSourceID="objectDataSource" 
                    EmptyDataText="< No Entries to Display >" onrowupdating="dataGridView_RowUpdating" 
                    Width="100%" OnRowDataBound="dataGridView_RowDataBound" 
                    AllowPaging="True">
                    <RowStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                        Font-Names="Arial" HorizontalAlign="Center" 
                        VerticalAlign="Middle" CssClass="StandardRowStyle" Font-Size="11pt" />
                    <EmptyDataRowStyle Font-Italic="False" HorizontalAlign="Center" 
                        VerticalAlign="Middle" CssClass="EmptyRowStyle" />
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox ID="rowSelector" runat="server" />
                            </ItemTemplate>
                            <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                Width="25px" />
                            <EditItemTemplate>
                                <table>
                                    <tr>
                                        <td align="left" style="width: 60px" valign="middle">
                                            <asp:Button ID="saveRowButton" runat="server" BackColor="MidnightBlue" 
                                                BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" 
                                                onclick="saveRowButton_Click" Text="Save" ToolTip="Save changes in row" 
                                                Width="60px" />
                                        </td>
                                        <td align="left" style="width: 60px" valign="middle">
                                            <asp:Button ID="cancelRowButton" runat="server" BackColor="MidnightBlue" 
                                                BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" 
                                                onclick="cancelRowButton_Click" Text="Cancel" ToolTip="Undo changes in row" 
                                                Width="60px" />
                                        </td>
                                    </tr>
                                </table>
                            </EditItemTemplate>
                            <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                HorizontalAlign="Center" VerticalAlign="Middle" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="User ID">
                            <EditItemTemplate>
                                <asp:TextBox ID="IDTextBox" runat="server" Text='<%# Eval("UserID") %>' 
                                    Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("UserID") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                            <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                VerticalAlign="Middle" HorizontalAlign="Center" Width="225px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="User Name">
                            <EditItemTemplate>
                                <asp:TextBox ID="nameTextBox" runat="server" Enabled="False" 
                                    Text='<%# Eval("Name") %>' Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="nameLabel" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                            <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                HorizontalAlign="Center" VerticalAlign="Middle" Width="250px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Permission Level">
                            <EditItemTemplate>
                                <asp:DropDownList ID="permissionDropDownList" runat="server" Width="95%">
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="permissionLabel" runat="server" Text='<%# Eval("Permission") %>'></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" />
                            <ItemStyle BorderColor="White" BorderStyle="Solid" BorderWidth="1px" 
                                HorizontalAlign="Center" VerticalAlign="Middle" Width="225px" />
                        </asp:TemplateField>
                    </Columns>
                    <PagerStyle CssClass="StandardPagerStyle" Font-Bold="True" 
                        Font-Names="Arial" Font-Size="12pt" ForeColor="MidnightBlue" 
                        HorizontalAlign="Center" VerticalAlign="Middle" />
                    <HeaderStyle BackColor="#C0C0FF" BorderColor="White" BorderStyle="Solid" 
                        BorderWidth="1px" Font-Bold="False" 
                        ForeColor="MidnightBlue" HorizontalAlign="Center" VerticalAlign="Middle" CssClass="StandardTableHeaderStyle" />
                    <EditRowStyle CssClass="StandardRowStyle" />
                    <AlternatingRowStyle BackColor="Gainsboro" BorderColor="White" 
                        BorderStyle="Solid" BorderWidth="1px" CssClass="StandardRowStyle" 
                        Font-Names="Arial" Font-Size="11pt" />

                </asp:GridView>
            </td>
            <td align="right" valign="top" width="90px">
                <asp:Panel ID="buttonsPanel" runat="server" HorizontalAlign="Center">
                    <asp:Button ID="addButton" runat="server" BackColor="MidnightBlue" 
                        BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                        Font-Names="Arial" ForeColor="White" OnClick="addButton_Click" 
                        Text="Add" ToolTip="Add new item to list" Width="70px" />
                    <br />
                    <br />
                    <asp:Button ID="modifyButton" runat="server" BackColor="MidnightBlue" 
                        BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                        Font-Names="Arial" ForeColor="White" onclick="modifyButton_Click" 
                        Text="Modify" ToolTip="Modify selected item" Width="70px" />
                    <br />
                    <br />
                    <asp:Button ID="removeButton" runat="server" BackColor="MidnightBlue" 
                        BorderColor="#C0C0FF" BorderStyle="Solid" BorderWidth="1px" 
                        Font-Names="Arial" ForeColor="White" OnClick="removeButton_Click" 
                        Text="Remove" ToolTip="Remove selected items" Width="70px" />
                </asp:Panel>
            </td>
        </tr>
    </table>
    <asp:ObjectDataSource ID="objectDataSource" runat="server" 
        DeleteMethod="RemoveUser" InsertMethod="AddUser" 
        SelectMethod="GetUsers" 
        TypeName="Danser_AJAXEnabledWebApplication.DataSourceManagers.UsersDataSourceManager" 
        UpdateMethod="ModifyUser">
        <DeleteParameters>
            <asp:Parameter Name="userId" Type="String" />
            <asp:Parameter Name="newRow" Type="Boolean" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="userID" Type="String" />
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="permission" Type="Object" />
            <asp:Parameter Name="newRow" Type="Boolean" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="userID" Type="String" />
            <asp:Parameter Name="name" Type="String" />
            <asp:Parameter Name="permission" Type="Object" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter DefaultValue="" Name="newRow" Type="Boolean" />
            <asp:Parameter Name="filter" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Panel>

                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="filterButton" />
                    </Triggers>
                </asp:UpdatePanel>
                <br />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Panel ID="descriptionsPanel" runat="server" Width="100%" 
                    CssClass="StandardLabelLight" Font-Names="Arial" 
                    Font-Size="10pt" ForeColor="MidnightBlue">
                    <asp:Label ID="Label1" runat="server" CssClass="StandardLabel" Text="Permission levels clarifications:"></asp:Label><br />
                    <br />
                    <asp:Label ID="Label2" runat="server" CssClass="StandardLabel" Text="Viewer - "></asp:Label><br />
                    <asp:Literal ID="Literal3" runat="server" 
                        Text="Minimal (and default) level. Allows the user to view (read only) data stored in system."></asp:Literal>&nbsp;<br />
                    <br />
                    <asp:Label ID="Label3" runat="server" CssClass="StandardLabel" Text="Editor - "></asp:Label><br />
                    <asp:Literal ID="Literal5" runat="server" 
                        Text="In addition to &quot;Viewer&quot; level capabilities, allows the user to feed the system with new data."></asp:Literal>&nbsp;<br />
                    <br />
                    <asp:Label ID="Label4" runat="server" CssClass="StandardLabel" Text="Manager -&nbsp;"></asp:Label><br />
                    <asp:Literal ID="Literal7" runat="server" 
                        Text="In addition to &quot;Editor&quot; level capabilities, allows the user to define validation templates (add, remove, modify), to confirm results and set confirmed results as anchors to other tests."></asp:Literal>&nbsp;<br />
                    <br />
                    <asp:Label ID="Label5" runat="server" CssClass="StandardLabel" Text="Administrator -&nbsp;"></asp:Label><br />
                    <asp:Literal ID="Literal9" runat="server" Text="Highest level. "></asp:Literal>
                <br />
                    <asp:Literal ID="Literal10" runat="server" 
                        Text="In addition to &quot;Manager&quot; level capabilities, allows the user to define other users' permissions, add a new user, remove or modify permissions of an existing one"></asp:Literal>
                </asp:Panel>
                <br />
                </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" runat="server" contentplaceholderid="head">

    <style type="text/css">

    .style3
    {
        width: 673px;
    }
        .style14
        {
            width: 28px;
        }
    </style>

</asp:Content>

